package com.syni.mdd.sjb.tool.entity.vo.responseVo;

import com.syni.mdd.sjb.common.component.utils.common.constants.Constants;
import com.syni.mdd.sjb.common.component.utils.common.utils.StringUtils;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class DataTreasureVersionRpVo {

    private IosVersionData iosVersionData;
    private AndVersionData andVersionData;

    @Data
    public static class IosVersionData{
        private String majorNum;
        private String minorNum;
        private String revisionNum;
        private String buildNum;
        private Integer isUpdateMandatory = Constants.COMMON_FLAG_FALSE_INT;
        private String updateDesc;
    }

    @Data
    public static class AndVersionData{
        private String majorNum;
        private String minorNum;
        private String revisionNum;
        private String buildNum;
        private Integer isUpdateMandatory = Constants.COMMON_FLAG_FALSE_INT;
        private String updateDesc;
    }

    public String handleDescText(String handleText){
        if(StringUtils.isNotBlank(handleText)){
            String[] version = handleText.split("##");
            List<String> texts = new ArrayList<>();
            for(String text : version){
                texts.add(text);
            }
            return StringUtils.join(texts,"\n");
        }
        return handleText;
    }
}
